Skip to content

Fix _as_numpy_array: use variable obj instead of string literal "obj"#14472

Open
algojogacor wants to merge 1 commit into
pytest-dev:mainfrom
algojogacor:fix/hasattr-obj-variable
Open

Fix _as_numpy_array: use variable obj instead of string literal "obj"#14472
algojogacor wants to merge 1 commit into
pytest-dev:mainfrom
algojogacor:fix/hasattr-obj-variable

Conversation

@algojogacor
Copy link
Copy Markdown

The second hasattr call in _as_numpy_array incorrectly passed the string literal "obj" instead of the variable obj when checking for __array_interface__. This caused objects implementing only __array_interface__ (without __array__) to not be recognized as numpy-like arrays by pytest.approx.

Closes #14456

The second hasattr call in _as_numpy_array incorrectly passed the
string literal "obj" instead of the variable obj when checking for
__array_interface__. This caused objects implementing only
__array_interface__ (without __array__) to not be recognized as
numpy-like arrays by pytest.approx.

Closes pytest-dev#14456
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_as_numpy_array: hasattr uses string literal 'obj' instead of variable

1 participant